package sell;
import java.util.ArrayList;
import java.util.Scanner;
class User {
    String username;
    String verificationCode;
    String email;
    int age;

    public User(String username, String verificationCode, String email, int age) {
        this.username = username;
        this.verificationCode = verificationCode;
        this.email = email;
        this.age = age;
    }

    public String toString() {
        return "用户名: " + username + " | 邮箱: " + email + " | 年龄: " + age;
    }
}
public class register {

        public static void main(String[] args) {
            ArrayList<User> users = new ArrayList<>();
            Scanner scanner = new Scanner(System.in);

            while (true) {
                System.out.println("请输入用户名 (输入0000退出系统):");
                String username = scanner.nextLine();

                if (username.equals("0000")) {
                    break;
                }

                System.out.println("请输入验证码 (四位字符串，从第三位开始):");
                String verificationCode = scanner.nextLine();

                if (verificationCode.length() != 4) {
                    System.out.println("验证码必须是四位字符串，从第三位开始！");
                    continue;
                }

                System.out.println("请输入邮箱:");
                String email = scanner.nextLine();

                System.out.println("请输入年龄:");
                int age = Integer.parseInt(scanner.nextLine());

                User newUser = new User(username, verificationCode, email, age);
                users.add(newUser);
            }

            System.out.println("已注册用户信息：");
            for (User user : users) {
                System.out.println(user.toString());
            }
        }
    }

